﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace KCMS.DataAcsess.Entitys
{
    public partial class PageEntity:Entity
    {
        //public String Title { get; set; }
        //public String Text { get; set; }
        //public String MetaDescription { get; set; }
        //public String MetaKeys { get; set; }
        //public DateTime DateOfCreate { get; set; }
        //public DateTime DateOfChange { get; set; }
        //public bool Published { get; set; }
        //public String Code { get; set; }
        //public Guid CategoryId { get; set; }
        //public int Index { get; set; }

        public void CopyPropyties(PageEntity source)
        {
            this.CategoryId = source.CategoryId;
            this.Code = source.Code;
            this.DateOfChange = source.DateOfChange;
            this.DateOfCreate = source.DateOfCreate;
            this.Id = source.Id;
            this.MetaDescription = source.MetaDescription;
            this.MetaKeys = source.MetaKeys;
            this.Text = source.Text;
            this.Title = source.Title;
            this.Published = source.Published;
            this.Index = source.Index;
            this.Layout = source.Layout;

            //PropertyInfo[] destinationProperties = this.GetType().GetProperties();
            //foreach (PropertyInfo destinationPI in destinationProperties)
            //{
            //    PropertyInfo sourcePI = source.GetType().GetProperty(destinationPI.Name);

            //    destinationPI.SetValue(this,
            //                           sourcePI.GetValue(source, null),
            //                           null);
            //}
        }
    }

}
